package com.yy.controller;

import com.yy.service.TestService;
import com.yy.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author young
 * @date 2022/12/24 20:05
 * @description:
 */
@RestController
@Slf4j
@RequestMapping("/hystrix")
public class HystrixProviderController {
   @Resource
   private TestService testService;
    
    @GetMapping("/use/{id}")
    public Result<String> get(@PathVariable("id") Integer id){
        return Result.ok(testService.ok(id));
    }

    @GetMapping("/wait/{id}")
    public Result<String> getWait(@PathVariable("id") Integer id){
       return Result.ok(testService.wait(id));
    }
}
